The simplest method of fuzzy query
In MySQL we can compare using the like or not like operators. Schema defaults are case-insensitive in MySQL.
Query example, Student table
+--------+---------+-------+-----------------+---------+| Studid | name | Marks | Address | Phone |+--------+---------+-------+-----------------+---------+
Mysql> SELECT * FROM student where name
mean that the matching string appears in the text string, only the first character appears in the text string. We must move the match string forward to see if the complete match string is contained in the text string.
Matching string matching
Code
/* -------------------------------- * Date: 2015-02-05 * Author: SJF0115 * Subject: string
MySQL fuzzy matching query like,regexp,inSummarythe content is relatively simple, no summary. Key Wordsfuzzy query like regexp in contactBodyis the data table information used by the sampleMySQL provides standard SQL pattern matching and an extended regular expression pattern matching format based on Unix utilities lik
=newselectedservers]"). attr ("checked", false); });The above code implements the function: When clicked Id= "Allser" the button, all the name name= "Newselectedservers" The checkbox is to be all selected, cancels the entire selection again when clicking again, the function is relatively simple, is no longer detailed.
Blur Select All
Fuzzy Select
Wangli] Fly ')4,[^] : Represents a single character that is not listed in parentheses. The value is the same as [], but it requires that the matched object be any character other than the specified character.For example SELECT * FROM [user] WHERE u_name like ' [^ Zhang Li Wang] three 'Will find the surname "Zhang", "Li", "Wang" "Zhao Three", "Magozo" and so on;For example SELECT * FROM [user] WHERE u_name like ' old [^1-4] 'Will exclude "old 1" to "Old 4", Looking for "old 5", "Old 6" 、......、
);
return $res;
}
2. Loop the SQL where statement according to the participle foreach ($fenci as $k = + $v) {
if (empty ($where)) {
$where. = "name like '%{$v}% '";
} else{
$where. = "OR name like '%{$v}% '";
}
}
3. Loop the SQL Order statement according to the particip
When executing a database query, there is a complete query and a fuzzy query.The general fuzzy statement is as follows:SELECT field from table WHERE a field like conditionwith regard to the conditions, SQL provides four matching modes: 1,%: denotes any 0 or more characters . Can match any type and length of characters, in some cases if Chinese, please use two per
This article mainly introduces the method of thinkphp to realize multi-field fuzzy matching query, and analyzes the related model operation and SQL statement of thinkphp for fuzzy matching query with the example form, and the friend can refer to the following
This paper describes the method of thinkphp to implement mu
| Birth | Death |+----------+-------+---------+------+------------+------------+| Claws | Gwen | Cat | m | 1994-03-17 | NULL || Bowser | Diane | Dog | m | 1989-08-31 | 1995-07-29 || Whistler | Gwen | Bird | NULL | 1997-12-09 | NULL |+----------+-------+---------+------+------------+------------+Now that if a regular expression appears anywhere in the value and its pattern matches, you don't have to put a wildcard in the two aspects of the pattern in the previous query so that it matches the ent
Nspredicate is used to specify filtering criteria, primarily for sorting out eligible objects from the collection, or for regular matching of strings. Introduction to common methods of nspredicate[OBJC]View Plaincopy
1. Create a nspredicate (equivalent to create a filter condition)
Nspredicate *predicate = [nspredicate predicatewithformat:@ "filter condition"];
2. Determine whether the specified object meets nspredicate created filte
usage is: SELECT * from Flow_user where regexp_like (username, ' [Zhang Wangli] Fly ')4.[^ ]: Represents a single character that is not listed within the parentheses. The value is the same as [], but it requires that the matched object be any character other than the specified character.For example SELECT * from [user] WHERE u_name like ' [^ Zhang Li Wang] three 'Will find the surname "Zhang", "Li", "Wang" "Zhao Three", "Magozo" and so on;For example SELECT * from [user] WHERE u_name like ' old
that you don't need to memorize the order, as long as you have a name.
However, if you want to extract more than one element from the list, you can only extract individual elements using single brackets (both brackets and dollar signs), and you know the order.
> x
The difference between the two brackets and the dollar sign:
The dollar sign must be the element name that exists in the list;
The two bracket
Match by name1,name jquery object with all div prefixes prefixed with AA$ ("div[name^= ' AA ']");2,name a jquery object with all div suffixes for AA$ ("div[name$= ' AA ']");jquery object in 3,name that contains all div for AA$ ("div[id*= ' AA ']");All of the above are return
Match by name1,name jquery object with all div prefixes prefixed with AAJS Code
$ ("div[name^= ' AA ']");
2,name a jquery object with all div suffixes for AAJS Code
$ ("div[name$= ' AA ']");
jquery object in 3,name that contains all div for AAJS
the later processing, the selected string can be made into a dictionary alternate with the other parameters used for(vari = 0; i ) {Names.push (resultlist[i].name); } returnprocess (names); }, Error:function(Result) {}}); }, Updater:function(item) {Check for future data processing. Item is the selected string,resultkeyandvalue is the alternate Dictionaryreferred to by the success function, where the re
Blog Category: Jqueryjquery by name match 1,name prefix for all div's jquery object JS code Collection code $ ("div[name^= ' AA ')"); 2,name suffix for all div's jquery object JS code Collection code $ ("div[name$= ' AA ')"); 3,name
# Match ID, first specify an HTML tag, and then add the "#" symbol, plus the ID of the attribute valueSelf.driver.find_element_by_css_selector (' Div#id '). Click ()# Match class, first specify an HTML tag, then add "." Symbol, plus the attribute value of classSelf.driver.find_element_by_css_selector (' Div. CLASS '). Click ()# Match Other propertiesSelf.driver.find_element_by_css_selector (' div[name=name]
This paper describes the method of thinkphp to implement multi-field fuzzy matching query. Share to everyone for your reference, as follows:
Introduction: Sometimes queries are matched to multiple fields. For example, a query address, the address is composed of multiple fields. There are provinces, municipalities, districts and so on, as well as detailed addresses. How do you check this time?
Implement the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.